/**
 * 〈功能简述〉<br>
 * 〈角色菜单接口实现〉
 *
 * @author LiJunYi
 * @create 2019/7/5
 * @since 1.0.0
 */
package com.ljy.system.marvel_sys.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ljy.system.marvel_sys.system.dao.RolePermissionDao;
import com.ljy.system.marvel_sys.system.model.role.RolePermission;
import com.ljy.system.marvel_sys.system.service.IRolePermissionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class RolePermissionServiceImpl extends ServiceImpl<RolePermissionDao, RolePermission> implements IRolePermissionService {

    @Resource
    RolePermissionDao rolePermissionDao;

    @Override
    public String queryByPermissionId(long pId) {
        List<RolePermission> rolePermissions = rolePermissionDao.selectList(new QueryWrapper<RolePermission>().lambda().eq(RolePermission::getPermissionId,pId));
        if(rolePermissions.size() == 0){
            // 未分配出去
            return "no";
        }else {
            return "exist";
        }
    }
}
